<?echo $javascript->link('prototype');?>

<div id="LoadingDiv" style="display: none;"><?php echo $html->image('ajax-loader.gif'); ?>
</div>

<div id="DatePaging"><?php echo $this->renderElement('dates/paging'); ?>
</div>

<?=$html->link('Add', 'display/add'); ?>


<?
//=========== Paging

echo $paginator->counter();

if(!$Dates){?>
<table id="skelbimas" border="1" width="100%">
<?
foreach($Dates as $date){

	//lg($date['Date']['date_id']);
	//lg($_SESSION);
	?>

	<tr>
		<th style="height: 30px;">Title</th>
		<td><?=$date['Date']['title']?></td>

		<?if(@$_SESSION['User']){?>
		<td rowspan="3"><?php echo $html->link('View','/dates/display/viewDate/' . $date['Date']['date_id'])?>
		<?php echo $html->link('Edit','/dates/display/editDate/' . $date['Date']['date_id'])?>
		<?php echo $html->link('Delete','/dates/display/delDate/' . $date['Date']['date_id'], null, 'Are you sure you want to delete id ' . $date['Date']['date_id'])?>

		</td>

		<?}?>
	</tr>

	<tr>
		<th><?php echo $paginator->sort('Search genre', 'search_genre');?></th>
		<th><?php echo $paginator->sort('Is genre', 'is_genre');?></th>
	</tr>
	<tr>
		<td>Text</td>
		<td><?=$date['Date']['text']?></td>
	</tr>
	<tr>
		<td>Is_genre</td>
		<td><?=$date['Date']['is_genre'];?></td>
	</tr>
	<tr>
		<td>Looking for</td>
		<td><?=$date['Date']['search_genre'];?></td>
	</tr>

	<?}?>
</table>


	<?php echo $paginator->prev(); ?>
	<?php echo $paginator->numbers(); ?>
	<?php echo $paginator->next();
}



//echo $html->input('Date/select', array('size'=>90));

?>



<?
//================== add Date

if(@$id == 'addDate'){ ?>

<?=$form->create('Date'); ?>
<table>
	<tr>
		<td>Title</td>
		<td><?=$form->text('title', array('size'=>90));?></td>
	</tr>
	<tr>
		<td>Text</td>
		<td><?=$form->textarea('Date/text', array('cols'=>70, 'rows' => 10));?></td>
	</tr>
	<tr>
		<td>Is</td>
		<td><?=$form->select('Date.is_genre', array('moteris'=>'Moteris', 'vyras'=>'Vyras'));?></td>
	</tr>
	<tr>
		<td>Looking for</td>
		<td><?=$form->select('Date.search_genre', array('moteris'=>'Moteris', 'vyras'=>'Vyras'));?></td>
	</tr>
	<tr>
		<td colspan="2" align="right"><?=$form->submit('Skelbti');?></td>
	</tr>
</table>
</form>
<? } ?>